namespace Yaaf.WP7.NativeAccess.ComWrapper.LG.COM_NewSysInfoComDLL
{
    using System;

    using Microsoft.Phone.InteropServices;

    using Yaaf.WP7.NativeAccess.Helper;

    internal class EGMClass
    {
        private IEGMInterface native;

        public EGMClass()
        {
            if (ComBridge.RegisterComDll("COM_NewSysInfoComDLL.dll", new Guid("B3BDED41-7A61-4388-8123-5ED1B185F002")) != 0)
            {
                throw new RegisterComException("RegisterComDll Failed.");
            }
            native = (IEGMInterface)new CLGEComSysteminfoComObject();
        }

        public uint GetDwordValueHKLM(string path, string name)
        {

            int num = 1;    // TODO dunno what the 'encoding' is
            int num2 = 2; // TODO this is HKLM, dunno what to do the HKCU
            uint ret = 0;

            native.RegGetValueDWORD(out num2, path, name, out ret, out num);
            return ret;
        }

        public void SetDwordValueHKLM(string root, string path, string name, uint value)
        {
            int num = 1;
            int num2 = 2; // TODO HKLM only

            native.RegSetValueDWORD(out num2, path, name, out value, out num);
        }

        public void SetStringValueHKLM(string root, string path, string name, string value)
        {
            int num = 1;
            int num2 = 2; // TODO HKLM only

            native.RegSetValueSZ(out num2, path, name, value, out num);
        }
    }
}